﻿$(function () {
    var nav_pa = $(".nav-pa");
    var collapse = $(".collapse");
    var navbar_toggler = $(".navbar-toggler");
    //header_nav导航
    $.each(nav_pa, function (i, ele) {
        $(ele).click(function () {
            $(this).children(".nav-sub").stop().slideToggle();
            $(this).siblings(".nav-pa").children(".nav-sub").slideUp();           
        });
    });
    var falg = 0;
    navbar_toggler.click(function () {
        if (falg === 0) {
            falg = 1;
            navbar_toggler.css("border", "3px solid #ccc");
        } else {
            falg = 0;
            navbar_toggler.css("border", "1px solid #ccc");
        }
        collapse.stop().slideToggle(); 
    });

    //尾部
    var setTime = $(".setTime");
    setInterval(countDown, 1000);
    function countDown() {
        var time = new Date();//返回当前的毫秒数
        // 获取年份
        var y = time.getFullYear();
        // 获取yue份,月份是从0-11
        var M = time.getMonth() + 1;
        M = M < 10 ? '0' + M : M;
        // 获取日
        var d = time.getDay();
        d = d < 10 ? '0' + d : d;
        // 获取时
        var h = time.getHours();
        h = h < 10 ? '0' + h : h;
        // 获取fen
        var m = time.getMinutes();
        m = m < 10 ? '0' + m : m;
        var s = time.getSeconds();
        s = s < 10 ? '0' + s : s;
        setTime.text(y + "-" + M + "-" + d + " " + h + ":" + m + ":" + s +" ");
    }
});